import unittest,time
from selenium import webdriver
from Page.Page import Page
from Page.Page1 import Page1
from Page.Page2 import Page2
from Page.Page3 import Page3
# from ddt import ddt,file_data

# @ddt
class Case(unittest.TestCase):
    def setUp(self):
        self.driver=webdriver.Edge()
        # self.driver.maximize_window()
        print('开始')
    def tearDown(self):
        self.driver.close()
        print('结束')

    # 执行登录
    # @file_data(r'D:\AMuaaaaa\Mupycharm\mu\gao6_2211A\poYueKai\Data\login.json')
    def test_001_login(self):
        po=Page(self.driver)
        po.open_url('http://localhost:8080/')
        time.sleep(2)
        po.login()
        time.sleep(2)
        po.username('qq')
        time.sleep(2)
        po.password('123')
        time.sleep(2)
        po.denglu()
        time.sleep(2)

    # 执行新增
    def test_002_add(self):
        po=Page1(self.driver)
        po.open_url('http://localhost:8080/')
        time.sleep(2)
        po.danjigame()
        time.sleep(2)
        po.addgame()
        time.sleep(2)
        po.shuruname('11.17.0')
        time.sleep(2)
        po.shurudate('2025-07-15')
        time.sleep(2)
        po.shurus('未发布')
        time.sleep(2)
        po.tijiao()
        time.sleep(2)
    # 执行查询
    def test_003_CaXun(self):
        po = Page2(self.driver)
        po.open_url('http://localhost:8080/')
        time.sleep(2)
        po.danjigame()
        time.sleep(2)
        po.caxunname('11.17.0')
        time.sleep(2)
        po.djcaxun()
        time.sleep(2)
    # 执行删除
    def test_004_Delete(self):
        po = Page3(self.driver)
        po.open_url('http://localhost:8080/')
        time.sleep(2)
        po.danjigame()
        time.sleep(2)
        po.djshanchu()
        time.sleep(2)

if __name__ == '__main__':
    unittest.main()